import { defineStore } from 'pinia'
import { ref } from 'vue'
import { queryHistory2, uploadRequest, UploadAv, uploadControl } from '@/api/gps/jt808/jt1078'
import moment from 'moment/moment'
import { formatDuration, bytesToSize } from '@/utils/gps/format'

import { useTrackStore } from '@/store/gps/track'

export const usePlaybackStore = defineStore('playbackStore', () => {
  // 列表数据
  const playbackList = ref([] as any[])
  // 当前选中的下标
  const curPlayingIndex = ref(-1)
  // 新的下标
  const newPlayingIndex = ref(-1)
  // 当前选中的数据
  const curRecordData = ref<any>()
  // 当前设备imei
  const curPlayBackDeviceImei = ref('')
  // 新的开始时间
  const newlineTime = ref(0)

  function reset() {
    playbackList.value = []
    curPlayingIndex.value = -1
    newPlayingIndex.value = -1
    curRecordData.value = {}
    newlineTime.value = 0
  }
  return {
    playbackList,
    curPlayingIndex,
    newPlayingIndex,
    curRecordData,
    curPlayBackDeviceImei,
    newlineTime,
    reset
  }
})
